namespace AonesoftBase.Biz
{
    using System;
    using System.Web.UI.WebControls;

    public static class TimeManager
    {
        public static void FillDayList(DropDownList ddl)
        {
            int day = DateTime.Now.Day;
            for (int i = 1; i <= 0x1f; i++)
            {
                ddl.Items.Add(i.ToString("00"));
            }
            ddl.SelectedValue = day.ToString("00");
        }

        public static void FillHours(DropDownList ddl, int iHoursCur)
        {
            for (int i = 0; i < 0x18; i++)
            {
                ddl.Items.Add(i.ToString("00"));
            }
        }

        public static void FillMinute(DropDownList ddl, int iMinuteCur)
        {
            for (int i = 0; i < 60; i++)
            {
                ddl.Items.Add(i.ToString("00"));
            }
        }

        public static void FillMonthDayList(DropDownList ddl, int strDay)
        {
            ddl.Items.Clear();
            for (int i = 1; i <= strDay; i++)
            {
                ddl.Items.Add(i.ToString("00"));
            }
        }

        public static void FillMonthList(DropDownList ddl)
        {
            int month = DateTime.Now.Month;
            for (int i = 1; i <= 12; i++)
            {
                ddl.Items.Add(i.ToString("00"));
            }
            ddl.SelectedValue = month.ToString("00");
        }

        public static void FillMonthListAgain(DropDownList ddl, string strMonth)
        {
            int month = DateTime.Now.Month;
            for (int i = 1; i <= 12; i++)
            {
                ddl.Items.Add(i.ToString("00"));
            }
            if (ddl.Items.FindByValue(strMonth) != null)
            {
                ddl.SelectedValue = strMonth;
            }
            else
            {
                ddl.SelectedValue = month.ToString("00");
            }
        }

        public static void FillYearListAgain(DropDownList ddl, string strYear)
        {
            int year = DateTime.Now.Year;
            for (int i = -1; i < 10; i++)
            {
                int num3 = year + i;
                ddl.Items.Add(num3.ToString());
            }
            if (ddl.Items.FindByValue(strYear) != null)
            {
                ddl.SelectedValue = strYear;
            }
            else
            {
                ddl.SelectedValue = year.ToString();
            }
        }
    }
}

